<template>
  <div>
      <Header></Header>
      <swiperBanner :list="swiperList"></swiperBanner>
      <sliderMenu :list="iconList"></sliderMenu>
      <recommend  :list="recommendList"></recommend>
      <weekend :list="weekendList"></weekend>
  </div>
</template>

<script>
import axios from "axios";
import Header from "./compoents/Header";
import swiperBanner from "./compoents/swiperBanner";
import sliderMenu from "./compoents/sliderMenu";
import recommend from "./compoents/recommend";
import weekend from "./compoents/weekend";

export default {
  name: "Home",
  data() {
    return {
      swiperList: [],
      iconList: [],
      recommendList: [],
      weekendList: []
    };
  },
  components: {
    Header,
    swiperBanner,
    sliderMenu,
    recommend,
    weekend
  },
  methods: {
    getInfo() {
      axios.get("/api/index.json").then(this.getHomeSucc);
    },
    getHomeSucc(res) {
      res = res.data;
      console.log(res);
      if (res.ret && res.data) {
        const data = res.data;
        this.swiperList = data.swiperList;
        this.iconList = data.iconList;
        this.recommendList = data.recommendList;
        this.weekendList = data.weekendList;
      }
    }
  },
  mounted() {
    this.getInfo();
  }
};
</script>

<style scoped>
</style>